<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>新型冠状病毒检测报告查询系统</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../static/css/layui.css" media="all">
    <style>
        html,
        body {
            width: 100%;
            height: 100%;
            overflow: hidden;
            background-size: 100% 100%;
        }
        h3{
            font-size: 18px;
            font-weight: 700;
            color: #fff;
            height: 6px;
            padding: 16px 0 30px 0; /* 上右下左 */
            margin-bottom: 1px;
            text-align: center;
            background-color: rgb(62, 172, 195);
        }

        .layui-container {
            padding: 0px;
        }


        span {
            position: absolute;
            color: #fff;
            font-size: 16px;
            font-weight: bold;
            margin-left: 80px;
            margin-top: 40px;
        }

        img {
            /* height: 100%; */
            width: 100%;
            background-repeat: no-repeat;
        }

        .one {
            padding: 10px 5px 0px 5px;
        }

        .two {
            padding: 0px 5px;
        }

        #login {
            position: absolute;
            width: 98%;
            background-color: rgb(62, 172, 195);
            color: black;
            margin: 0 1%;
        }

        /*下面 - 查询指引*/
        .zhidaoContain{
            font-size: 14px;
            color: #999;
            margin-top: 15px;
            margin-left: 10px;
            margin-right: 10px;
        }
        .time{
            width: 50%;
            text-align: center;
            float: left;
        }
        .suojin{
            text-indent: 2em;
            margin-top: 5px;
        }
    </style>
</head>

<body>
<h3>新型冠状病毒检测报告查询系统</h3>
<div class="layui-container">
    <form class="layui-form" action="">
        <div class="layui-central">
            <div class="layui-carousel" id="test1">
                <div carousel-item>
                    <!--里面可以加图片，文字等-->
                    <div><img src="../static/images/1.png" /></div>
                    <div><img src="../static/images/2.png" /></div>
                    <div><img src="../static/images/3.png" /></div>
                </div>
            </div>
            <div class="layui-form-item one">
                <input type="text" name="username" id="username" lay-verify="required|account" placeholder="请输入您的姓名" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-item two">
                <input type="text" name="idnumber" id="idnumber" lay-verify="required|account" placeholder="请输入您的身份证号码" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-footer">
            <button type="button" id="login" class="layui-btn">查询</button>
        </div>
    </form>
</div>

<br>
<br>
<br>
<div class="zhidaoContain">
    <div class="suojin" style="margin-bottom: 5px;">新型冠状病毒肺炎（Corona Virus Disease 2019，COVID-19）核酸检测结果查询指引：</div>
    <div id="time">
        <div><p class="timeStart time">检测时间</p><p class="timeEnd time">结果查询时间</p></div>
        <div><p class="timeStart time">当日16：00之前采集</p><p class="timeEnd time"> 当日18：00之后查询</p></div>
        <div><p class="timeStart time">当日16：00之后采集</p><p class="timeEnd time"> 次日18：00之后查询</p></div>
    </div>
    <div class="suojin">注:检测时未登记身份证号的，请到医院自助报告打印机凭缴费单门诊号自行打印检测报告。</div>
</div>
<script src="../static/js/jquery-3.4.1.js" charset="utf-8"></script>
<script src="../static/js/layui/layui.js" charset="utf-8"></script>
<script src="../static/js/jquery.particleground.min.js"></script>
<script>
    $(function() {
        $("#username").blur(function() {
            $("#names").empty();
            var name = $(this).val();
            if (name == "" || name == null) {
                $("#username").after("<span id='names' style='color: red;font-size:12px;margin-left:20px;margin-top:-2px;'>用户名不能为空</span>");
            }
        });
        $("#idnumber").blur(function() {
            $("#number").empty();
            var pwd = $(this).val();
            var regIdNo = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
            if (pwd == "" || pwd == null) {
                $("#idnumber").after("<span id='number' style='color: red;font-size:12px;margin-left:20px;margin-top:-3px;'>身份证号不能为空</span>");
            } else if (!regIdNo.test(pwd)) {
                $("#idnumber").after("<span id='number' style='color: red;font-size:12px;margin-left:20px;margin-top:-3px;'>身份证号格式错误</span>");
            }
        });
    })
</script>
<script type="text/javascript" src="../static/js/layui/layui.js"></script>
<script>
    //第一个轮播图
    layui.use('carousel', function() {
        var carousel = layui.carousel;
        //建造实例化
        carousel.render({
            elem: '#test1',
            width: '100%', //设置背景容器的宽度
            height: '160px',
            arrow: 'always', //始终显示箭头,不会消失
            //anim: 'updown' //切换动画方式:anim
            //indicator:'outside',
            indicator: 'inside' //这个属性：小圆点在外面
        });
    });
</script>
<script>
    $("#login").click(function() {
        userName = $('input[name="username"]').val().replace(/\s+/g, "");
        idnumber = $('input[name="idnumber"]').val().replace(/\s+/g, "");
        var regIdNo = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
        if (userName == '') {
            $.toast('姓名不能为空');
        } else if (idnumber == '') {
            $.toast('身份证号码不能为空');
        } else if (!regIdNo.test(idnumber)) {
            $.toast('身份证号码格式错误！请重新填写');
        } else {
            // 访问后台进行登录验证
            $.ajax({
                url: '/querydata',
                // async: false,
                // cache: false,
                type: "post",
                dataType: 'json',
                data: {
                    idNumber: idnumber
                },
                success: function(data) {
                    console.log(data.code);
                    console.log(data.toString());
                    if (data.code == 200) {
                        alert('查询成功！');
                        console.log(data.data);
                        console.log(idnumber);
                        window.location.href = '../templates/index.html?idnumber='+idnumber;
                    } else {
                        alert('暂未查询出结果，请耐心等待或联系医院工作人员！');
                    }
                }
            });
        }
    })
</script>
</body>

</html>